<template>
  <div>
    <div class="banner" @click="handleBannerClick">
      <img class="img-content" :src="bannerImg">
      <div class="text-info">
        <p class="text-desc">{{sightName}}</p>
        <div class="more-pic">
          <span class="iconfont banner-icon">&#xe63e;</span>
          {{gallaryImgs.length}}
        </div>
      </div>
    </div>
    <fade-animation>
      <common-gallary :imgUrl="gallaryImgs"
                      v-show="showSwiper"
                      @close="handleClockSwiper"
      ></common-gallary>
    </fade-animation>
  </div>
</template>

<script>
import CommonGallary from 'common/gallary/Gallary'
import FadeAnimation from 'common/fade/FadeAnimation'
export default {
  name: 'DetailBanner',
  props: {
    sightName: String,
    bannerImg: String,
    gallaryImgs: Array
  },
  components: {
    CommonGallary,
    FadeAnimation
  },
  data () {
    return {
      showSwiper: false
    }
  },
  methods: {
    handleBannerClick () {
      this.showSwiper = true
    },
    handleClockSwiper () {
      this.showSwiper = false
    }
  }
}
</script>

<style lang="stylus" scoped>
  .banner
    position: relative
    overflow: hidden
    height: 0
    padding-bottom: 55%
    .img-content
      width: 100%
    .text-info
      display: flex
      position: absolute
      left: 0
      right: 0
      bottom: 0
      height: .4rem
      line-height: .4rem
      padding: .2rem
      font-size: .38rem
      color: #fff
      background-image: linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8))
      .text-desc
        flex: 1
      .more-pic
        padding: 0 .2rem
        background: rgba(0, 0, 0, 0.5)
        border-radius: .2rem
        .banner-icon
          font-size: .38rem
</style>
